/*
 * SerialCommunicationManager.h
 *
 * @author: Bematech S.A.
 */

#ifndef __BILBAO_PROTOCOL_SERIAL_SERIAL_COMMUNICATION_MANAGER_CLASS_H__
#define __BILBAO_PROTOCOL_SERIAL_SERIAL_COMMUNICATION_MANAGER_CLASS_H__

#include "bilbao/types.h"
#include "bilbao/util/SerialPort.h"
#include "bilbao/protocol/serial/SerialCommunication.h"

namespace bilbao
{

	namespace protocol
	{

		namespace serial
		{
			class SerialCommunication;

			class SerialCommunicationManager
			{
			public:
				static SerialCommunicationManager* getInstance( void );

				SerialCommunication* demandSerialCommunication( util::SerialPort* sp );

				virtual ~SerialCommunicationManager( void );

			protected:
				SerialCommunicationManager( void );

				std::map<util::SerialPort*, SerialCommunication*> _serialCommunications;

				/**
				 *
				 */
				static SerialCommunicationManager* _instance;

				/**
				 *
				 */
				static SerialCommunication* _result;
			};

		}

	}

}

#endif //__BILBAO_PROTOCOL_SERIAL_SERIAL_COMMUNICATION_MANAGER_CLASS_H__
